<?php

/**
 * Licensee filter form base class.
 *
 * @package    symfony
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseLicenseeFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'licensee_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUserProfile'), 'add_empty' => true)),
      'licensee_number'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'lastname'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'firstname'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'category'         => new sfWidgetFormChoice(array('choices' => array('' => '', 'P' => 'P', 'B1' => 'B1', 'B2' => 'B2', 'M1' => 'M1', 'M2' => 'M2', 'C1' => 'C1', 'C2' => 'C2', 'J1' => 'J1', 'J2' => 'J2', 'J3' => 'J3', 'S' => 'S', 'V1' => 'V1', 'V2' => 'V2', 'V3' => 'V3', 'V4' => 'V4'))),
      'status'           => new sfWidgetFormChoice(array('choices' => array('' => '', 'joue' => 'joue', 'en repos' => 'en repos'))),
      'team_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Team'), 'add_empty' => true)),
      'club_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Club'), 'add_empty' => true)),
      'slug'             => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'licensee_user_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('sfGuardUserProfile'), 'column' => 'id')),
      'licensee_number'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'lastname'         => new sfValidatorPass(array('required' => false)),
      'firstname'        => new sfValidatorPass(array('required' => false)),
      'category'         => new sfValidatorChoice(array('required' => false, 'choices' => array('P' => 'P', 'B1' => 'B1', 'B2' => 'B2', 'M1' => 'M1', 'M2' => 'M2', 'C1' => 'C1', 'C2' => 'C2', 'J1' => 'J1', 'J2' => 'J2', 'J3' => 'J3', 'S' => 'S', 'V1' => 'V1', 'V2' => 'V2', 'V3' => 'V3', 'V4' => 'V4'))),
      'status'           => new sfValidatorChoice(array('required' => false, 'choices' => array('joue' => 'joue', 'en repos' => 'en repos'))),
      'team_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Team'), 'column' => 'id')),
      'club_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Club'), 'column' => 'id')),
      'slug'             => new sfValidatorPass(array('required' => false)),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('licensee_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Licensee';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'licensee_user_id' => 'ForeignKey',
      'licensee_number'  => 'Number',
      'lastname'         => 'Text',
      'firstname'        => 'Text',
      'category'         => 'Enum',
      'status'           => 'Enum',
      'team_id'          => 'ForeignKey',
      'club_id'          => 'ForeignKey',
      'slug'             => 'Text',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
    );
  }
}
